/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.bookingmanager.services;

import cz.muni.fi.pa165.bookingmanager.entities.Hotel;
import cz.muni.fi.pa165.bookingmanager.entities.Reservation;
import cz.muni.fi.pa165.bookingmanager.entities.Room;
import cz.muni.fi.pa165.bookingmanager.exceptions.IllegalOrphanException;
import cz.muni.fi.pa165.bookingmanager.exceptions.NonexistentEntityException;
import cz.muni.fi.pa165.bookingmanager.exceptions.PreexistingEntityException;
import cz.muni.fi.pa165.bookingmanager.other.PaymentStatusEnum;
import java.util.Date;
import java.util.List;
import javax.ejb.Local;

/**
 *
 * @author Daniel Sák
 */
@Local
public interface ReservationService {
    /**
     * Creates new Reservation in DB and sets its ID
     * @param reservation 
     * 
     * @throws IllegalOrphanException when reservation id is already set
     * @throws PreexistingEntityException 
     * @throws IllegalArgumentException when hotel is null
     * 
     */
    public void createReservation(Reservation reservation) throws IllegalOrphanException, PreexistingEntityException;
    
    /**
     * Updates Reservation given in param
     * @param reservation
     * @throws IllegalOrphanException when reservation id is already set
     * @throws NonexistentEntityException 
     * @throws IllegalArgumentException when reservation is null
     */
    public void updateReservation(Reservation reservation) throws IllegalOrphanException, NonexistentEntityException;
    
    /**
     * Delete Reservation given in param
     * @param reservation 
     * 
     * @throws IllegalArgumentException when reservation == null
     * @throws IllegalOrphanException when reservation id == null
     * @throws NonexistentEntityException when Reservation with set id doesn't exist in database
     */
    public void deleteReservation(Reservation reservation) throws IllegalOrphanException, NonexistentEntityException;
    
    /**
     * Retrieve Reservation selected by ID and returns it
     * @param resID
     * @return Reservation
     */
    public Reservation getResevationByID(Long resID);
    
    
    /**
     * Finds list of all Reservation in selected Hotel
     * @param hotel
     * @return List<Reservation>
     */
    public List<Reservation> findAllHotelReservations(Hotel hotel);
    
    /**
     * Finds list of all Reservation of certain Room and returns it
     * @param room
     * @return List<Reservation>
     */
    public List<Reservation> findAllRoomReservations(Room room);
    
    /**
     * Finds list of all Reservation which started on given time in certain Hotel
     * and returns it
     * @param hotel
     * @param startDate
     * @return List<Reservation>
     */
    public List<Reservation> findAllHotelReservations(Hotel hotel, Date startDate);
    
    /**
     * Finds list of all Reservation which started on given time of certain Room
     * and returns it
     * @param room
     * @param startDate
     * @return List<Reservation>
     */
    public List<Reservation> findAllRoomReservations(Room room, Date startDate);
    
    /**
     * Find all paid or unpaid reservation and returns list required reservation
     * @param paid
     * @return List<Reservation>
     */
    public List<Reservation> findAllReservationsByPaid(PaymentStatusEnum paid);
}


